'''
This is really a very simple a64dbg python adp demo.
'''
# import basic adp definition like error/event code
from adpdef import *
# import adp api entries
from adp import *
import os

# send kbsync result to here
def kbsync_result_callback(buf):
  print('kbsync result is : %s' % (buf))

# a64dbg debugengine event for python plugin
def adp_on_event(args):
    event = args[adp_inkey_type]
    # user clicked the plugin's main menu
    if event == adp_event_main_menu:
        # kbsync calc is valid on ios platform
        if curPlatform() == adp_remote_unicornvm_ios:
            runadc('%s/kbsync.mm' % (os.path.dirname(__file__)))
            return success()
    # ask for plugin's menu name
    if event == adp_event_menuname:
        return success('iTunesStoredKBSync')
    # ask for plugins's version and descripton 
    if event == adp_event_adpinfo:
        return success(('0.1.0', 'This is an itunesstored kbsync calc python plugin.'))
    return failed(adp_err_unimpl)
